/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import { request as __request, checkJsonSchema as __checkJsonSchema } from '../../core/request';
const schemas = require("../schema").default;

export class RestApiManagementService {

    /**
     * 用户通过前端添加RestAPI文档
     * @returns any OK
     * @throws ApiError
     */
    public static async addRestApiDoc({
        productVId,
        requestBody,
    }: {
        productVId: string,
        requestBody?: {
            /**
             * 产品版本ID
             */
            productVId: string,
            /**
             * RestAPI文档名
             */
            title: string,
            /**
             * 文档内容
             */
            content: any,
        },
    }): Promise<{
        /**
         * 值为0，操作成功
         */
        optResult: number,
        /**
         * 操作失败说明
         */
        msg?: string,
        /**
         * RestAPI文档入库成功编号
         */
        id: string,
    }> {
        const result = await __request({
            method: 'POST',
            path: `/rest-api-admin/v1/${productVId}/api-doc`,
            body: requestBody,
        });

        __checkJsonSchema("addRestApiDoc", schemas, result);
        return result.body;
    }

    /**
     * 用户通过前端列举RestAPI文档
     * @returns any OK
     * @throws ApiError
     */
    public static async listRestApiDoc({
        productVId,
        requestBody,
    }: {
        productVId: string,
        requestBody?: {
            /**
             * 产品版本ID
             */
            productVId: string,
            /**
             * 分页查询的页数
             * 1）不传该参数，查询内容不分页
             * 2）传大于等于1的整数时，分页查询
             */
            pageNum?: number,
            /**
             * 分页查询的每页数据条数，取值范围 1-100。默认提取20条
             */
            pageDataCount?: number,
        },
    }): Promise<{
        /**
         * 值为0，操作成功
         */
        optResult: number,
        /**
         * 操作失败说明
         */
        msg?: string,
        /**
         * RestAPI文档信息列表
         */
        apiDocs: Array<{
            /**
             * RestAPI文档名称
             */
            title: string,
            /**
             * RestAPI文档内容
             */
            content: any,
        }>,
    }> {
        const result = await __request({
            method: 'GET',
            path: `/rest-api-admin/v1/${productVId}/api-doc`,
            body: requestBody,
        });

        __checkJsonSchema("listRestApiDoc", schemas, result);
        return result.body;
    }

    /**
     * 用户通过前端修改RestAPI文档
     * @returns any Example response
     * @throws ApiError
     */
    public static async modRestApiDoc({
        productVId,
        title,
        requestBody,
    }: {
        productVId: string,
        title: string,
        requestBody?: {
            /**
             * 产品版本ID
             */
            productVId: string,
            /**
             * 修改后的文档内容
             */
            content: any,
        },
    }): Promise<{
        /**
         * 值为0，操作成功
         */
        optResult: number,
        /**
         * 操作失败说明
         */
        msg?: string,
    }> {
        const result = await __request({
            method: 'PUT',
            path: `/rest-api-admin/v1/${productVId}/api-doc/${title}`,
            body: requestBody,
        });

        __checkJsonSchema("modRestApiDoc", schemas, result);
        return result.body;
    }

    /**
     * 用户通过前端列举RestAPI文档
     * @returns any OK
     * @throws ApiError
     */
    public static async getRestApiDoc({
        productVId,
        title,
        requestBody,
    }: {
        productVId: string,
        title: string,
        requestBody?: {
            /**
             * 产品版本ID
             */
            productVId: string,
            /**
             * 文档名称
             */
            title: string,
        },
    }): Promise<{
        /**
         * 值为0，操作成功
         */
        optResult: number,
        /**
         * 操作失败说明
         */
        msg?: string,
        /**
         * RestAPI文档内容
         */
        content: any,
    }> {
        const result = await __request({
            method: 'GET',
            path: `/rest-api-admin/v1/${productVId}/api-doc/${title}`,
            body: requestBody,
        });

        __checkJsonSchema("getRestApiDoc", schemas, result);
        return result.body;
    }

    /**
     * 用户通过前端删除RestAPI文档
     * @returns any Example response
     * @throws ApiError
     */
    public static async deleteRestApiDoc({
        productVId,
        title,
        requestBody,
    }: {
        productVId: string,
        title: string,
        requestBody?: {
            /**
             * 产品版本ID
             */
            productVId: string,
            /**
             * 文档名称
             */
            title: string,
        },
    }): Promise<{
        /**
         * 值为0，操作成功
         */
        optResult: number,
        /**
         * 操作失败说明
         */
        msg?: string,
    }> {
        const result = await __request({
            method: 'DELETE',
            path: `/rest-api-admin/v1/${productVId}/api-doc/${title}`,
            body: requestBody,
        });

        __checkJsonSchema("deleteRestApiDoc", schemas, result);
        return result.body;
    }

    /**
     * 用户通过前端导入OpenAPI文档
     * @returns any OK
     * @throws ApiError
     */
    public static async importOpenApiDoc({
        productVId,
        requestBody,
    }: {
        productVId: string,
        requestBody?: {
            /**
             * 产品版本ID
             */
            productVId: string,
            /**
             * RestAPI文档名
             */
            title: string,
            /**
             * 文档内容
             */
            content: any,
        },
    }): Promise<{
        /**
         * 值为0，操作成功
         */
        optResult: number,
        /**
         * 操作失败说明
         */
        msg?: string,
        /**
         * RestAPI文档入库成功编号
         */
        id: string,
    }> {
        const result = await __request({
            method: 'POST',
            path: `/open-api-admin/v1/${productVId}/api-doc-import`,
            body: requestBody,
        });

        __checkJsonSchema("importOpenApiDoc", schemas, result);
        return result.body;
    }

    /**
     * 用户通过前端导出OpenAPI文档
     * @returns any OK
     * @throws ApiError
     */
    public static async exportOpenApiDoc({
        productVId,
        title,
        requestBody,
    }: {
        productVId: string,
        title: string,
        requestBody?: {
            /**
             * 产品版本ID
             */
            productVId: string,
            /**
             * RestAPI文档名
             */
            title: string,
        },
    }): Promise<{
        /**
         * 值为0，操作成功
         */
        optResult: number,
        /**
         * 操作失败说明
         */
        msg?: string,
        /**
         * RestAPI文档内容
         */
        content: string,
    }> {
        const result = await __request({
            method: 'POST',
            path: `/open-api-admin/v1/${productVId}/api-doc-export/${title}`,
            body: requestBody,
        });

        __checkJsonSchema("exportOpenApiDoc", schemas, result);
        return result.body;
    }

    /**
     * 用户通过前端批量导入OpenAPI文档
     * @returns any OK
     * @throws ApiError
     */
    public static async importBatchtOpenApi({
        productVId,
        requestBody,
    }: {
        productVId: string,
        requestBody?: {
            /**
             * 产品版本ID
             */
            productVId: string,
            /**
             * RestAPI文档信息列表
             */
            apiDocs: Array<{
                /**
                 * RestAPI文档名称
                 */
                title: string,
                /**
                 * RestAPI文档内容
                 */
                content: any,
            }>,
        },
    }): Promise<{
        /**
         * 值为0，操作成功
         */
        optResult: number,
        /**
         * 操作失败说明
         */
        msg?: string,
        /**
         * 导入任务ID列表，任务ID为UUID
         */
        taskIdList: Array<any>,
    }> {
        const result = await __request({
            method: 'POST',
            path: `/open-api-admin/v1/${productVId}/api-doc-import/batch`,
            body: requestBody,
        });

        __checkJsonSchema("importBatchtOpenApi", schemas, result);
        return result.body;
    }

    /**
     * 用户通过前端导出OpenAPI文档
     * @returns any OK
     * @throws ApiError
     */
    public static async exportBatchtOpenApi({
        productVId,
        requestBody,
    }: {
        productVId: string,
        requestBody?: {
            /**
             * 产品版本ID
             */
            productVId: string,
            /**
             * RestAPI文档名
             */
            title: string,
        },
    }): Promise<{
        /**
         * 值为0，操作成功
         */
        optResult: number,
        /**
         * 操作失败说明
         */
        msg?: string,
        /**
         * RestAPI文档内容
         */
        results: Array<{
            /**
             * RestAPI文档名称
             */
            title: string,
            /**
             * 值为0，操作成功
             */
            result: number,
            /**
             * 导出失败的原因
             */
            errorDesc?: string,
        }>,
    }> {
        const result = await __request({
            method: 'POST',
            path: `/open-api-admin/v1/${productVId}/api-doc-export/batch`,
            body: requestBody,
        });

        __checkJsonSchema("exportBatchtOpenApi", schemas, result);
        return result.body;
    }

}